home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE14 / TIPTRIX / POWER.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1996-09-07  |  559 b   |  32 lines

  1. {(C) 1996 Pijl Computer Services Ltd. Check laptop power situation}
  2. Unit Power;
  3. Interface
  4. Function PowerMan:Integer;
  5. Implementation
  6. Function PowerMan:Integer;
  7. Var
  8.   Fault,Batt,Life:Byte;
  9. begin
  10.   asm
  11.     mov fault,00h
  12.     mov ax,5300h
  13.     mov bx,0000h
  14.     int 15h
  15.     jc @err
  16.     mov ax,530ah
  17.     mov bx,0001h
  18.     int 15h
  19.     mov batt,bl
  20.     mov life,cl
  21.     jc @err
  22.     jmp @done
  23.     @err: mov fault,AH
  24.     @done: nop
  25.   end;
  26.   If (Fault=0) aAnd (Life in [0..100]) then
  27.     PowerMan := Life
  28.   else
  29.     PowerMan := -1;
  30.  end;
  31. end.
  32.